<template>
	<view class="container">
		<index-brand v-for="(item, index) in brandData" :key="index" :item="item" @brandItemClick="onBrandItemClick"></index-brand>
		<copyright></copyright>
	</view>
</template>

<script>
	import copyright from './components/copyright.vue'
	import indexBrand from './components/brand.vue'
	import {Home} from '@/models/home.js'
	const homeModel = new Home()
	export default {
		data() {
			return {
				brandData: []
			}
		},
		components:{
			indexBrand,
			copyright,
		},
		methods: {
			_loadMarketBrand () {
				homeModel.getMarketBrand((data) => {
					this.brandData = data
				})
			},
			onBrandItemClick(options){
				uni.navigateTo({
					url: '/pages/brand/brand?id=' + options.id
				})
			}
		},
		onLoad: function(options) {
			this._loadMarketBrand()
		},
		onPullDownRefresh(){
			homeModel.getMarketBrand((data) => {
				this.brandData = data
				uni.stopPullDownRefresh()
			})
		},
		onShareAppMessage () {},
		onShareTimeline () {}
	}
</script>

<style>
	
</style>
